<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<%@ page import="javax.persistence.EntityTransaction,javax.persistence.EntityManagerFactory,javax.persistence.EntityManager" %>
<%@ page import="treqs.model.HibernateUtil,treqs.model.Requirement,treqs.model.Requirementpriority,treqs.model.Requirementstatus"%>
<%@ page import="java.util.List, java.util.Iterator" %>

	<fieldset>
		<legend>Fields</legend>
		<%
		try
		{			
			EntityManagerFactory emf = HibernateUtil.getEntityManagerFactory();
			EntityManager em = emf.createEntityManager();
			EntityTransaction tx = em.getTransaction();
			tx.begin();
	
			int requirementID = Integer.parseInt(request.getParameter("id"));
			Requirement requirement = em.find(Requirement.class, requirementID);
            out.println("<p>UID:<br>" + requirement.getUid() + "</p>");
            out.println("<p>Name:<br>" + requirement.getName() + "</p>");
            out.println("<p>Description:<br>" + requirement.getDescription() + "</p>");
            out.println("<p>Rationale:<br>" + requirement.getRationale() + "</p>");
            out.println("<p>Comment:<br>" + requirement.getComment() + "</p>");
            out.println("<p>Revision:<br>" + requirement.getRevision() + "</p>");
            out.println("<p>Priority:<br>" + requirement.getRequirementpriority().getValue() + "</p>");
            out.println("<p>Status:<br>" + requirement.getRequirementstatus().getValue() + "</p>");
            out.println("<p>CreationDate:<br>" + requirement.getCreationDate() + "</p>");
            out.println("<p>DeletionDate:<br>" + requirement.getDeletionDate() + "</p>");
            out.println("<p>EditDate:<br>" + requirement.getEditDate() + "</p>");
            out.println("<p>EditLog:<br>" + requirement.getEditLog() + "</p>");

			tx.commit();
			em.close();
		}
		catch (Exception ex)
		{
			out.println(ex.toString());
		}
		%>
	</fieldset>
